<template>
  <div class="user">
      <div class="form">
            <el-form :inline="true" :model="searchForm" class="demo-form-inline">
                <el-form-item label="商户姓名/店铺名称">
                    <el-input v-model="searchForm.name" placeholder="商户姓名/店铺名称"></el-input>
                </el-form-item>
                <el-form-item label="注册时间">
                    <el-date-picker
                        v-model="searchForm.time"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        value-format="yyyy-MM-dd">
                    </el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">查询</el-button>
                    <!-- <el-button type="primary" @click="onAdd">新建</el-button> -->
                </el-form-item>
            </el-form>
      </div>
      <div class="form-body">
          <el-table
            :data="tableData.dataList"
            border
            style="width: 100%">
            <el-table-column
                prop="id"
                label="商户id">
            </el-table-column>
            <el-table-column
                prop="phone"
                label="手机">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="注册时间">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="姓名">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="性别">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="身份证号">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="昵称">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="微信号">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="商户店铺名称">
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button
                    size="mini"
                    @click="toFreeze(scope.$index, scope.row)">冻结</el-button>
                    <el-button
                    size="mini"
                    type="danger"
                    @click="toBack(scope.$index, scope.row)">恢复</el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class="clearfix pt15">
            <div class="fr">
                <el-pagination
                    background
                    layout="total, prev, pager, next"
                    :total="tableData.total"
                    :page-size="10"
                    :current-page="tableData.currentPage"
                    @current-change="currentChange">
                </el-pagination>
            </div>
        </div>
      </div>
      <!-- <edit /> -->
  </div>
</template>

<script>
import { mapGetters } from 'vuex';
import pageMixin from "@/mixins/pageMixin";
// import Edit from "./edit/user";

export default {
    mixins: [pageMixin],

    // components: { Edit },

    data () {
        return {
            searchForm: {
                name: '',
                time: ''
            },
            pageName: 'businessList'
        }
    },

    computed: {
        ...mapGetters({
            tableData: 'businessList/tableData',
            editData: 'businessList/editData'
        })
    },

    created () {
        
    },

    methods: {
        toFreeze() {
            this.$confirm('确定冻结此商户账号？', '冻结账号', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$message({
                    type: 'success',
                    message: '成功!'
                });
            }).catch(() => {});
        },
        toBack() {
            this.$confirm('确定恢复此商户账号？', '恢复账号', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$message({
                    type: 'success',
                    message: '成功!'
                });
            }).catch(() => {});
        }
    }
}
</script>

<style >

</style>
